<?php

class Form_Change extends Zend_Form_Subform
{

    public function init()
    {
        $this->setName('Change');
        $this->setMethod('post');
        
        $new_email = new Zend_Form_Element_Text('email');
        $new_email->setLabel('New email:')
        		->addValidator('EmailAddress')
        		->addValidator('StringLength', false, array('max' => 160))
        		->addFilter('StringTrim')
        		->addFilter('StripTags');
        
        $new_password = new Zend_Form_Element_Password('new_password');
        $new_password->setLabel('New password:')
        		->addValidator('StringLength', false, array('min' => 6, 'max' => 40))
        		->addFilter('StringTrim')
        		->addFilter('StripTags');
        		
		$new_confirm = new Zend_Form_Element_Password('confirm');
        $new_confirm->setLabel('Confirm new password:')
        		->setIgnore(true)
        		->addValidator('Identical', false, array('token' => 'new_password'))
        		->addFilter('StringTrim')
        		->addFilter('StripTags');
        		
        $submit = new Zend_Form_Element_Submit('change');
        $submit->setLabel('Save');
        
        $login = new Form_Login();
        $login->removeElement('login');
        $login->getElement('email')->setLabel('Current email:');
        $login->getElement('password')->setLabel('Current password:');

        $this->addSubForm($login, 'current');
        
        $this->addElements(array($new_email,$new_password,$new_confirm,$submit));
        
        
    }


}

